package org.jspresso.model.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.jspresso.framework.application.backend.persistence.hibernate.HibernateBackendController;
import org.jspresso.framework.application.backend.session.EMergeMode;
import org.jspresso.framework.model.component.service.AbstractComponentServiceDelegate;
import org.jspresso.framework.model.component.service.IComponentService;
import org.jspresso.model.TestEntity;
import org.jspresso.model.TestScope;

/**
 * Generated by Jspresso Developer Studio
 */
public class TestScopeServiceDelegate 
      extends AbstractComponentServiceDelegate<TestScope>
      implements TestScopeService, IComponentService {

	@Override
	public List<TestEntity> retrieveScopeContent(HibernateBackendController controller) {
		
		TestScope scope = getComponent();
		DetachedCriteria testEntitiesCriteria = DetachedCriteria.forClass(TestEntity.class);
		testEntitiesCriteria.add(Restrictions.eq(TestEntity.TEST_SCOPE, scope));
		testEntitiesCriteria.add(Restrictions.eq(TestEntity.RESULT_ENTITY, false));
		List<TestEntity> testEntities = controller.findByCriteria(testEntitiesCriteria, EMergeMode.MERGE_CLEAN_EAGER, TestEntity.class);
		
		return testEntities;
	}

        
}